From: Bastien Nocera Date: Tue, 18 Jan 2022 10:14:47 +0000 (+0100) Subject: status/bluetooth: Fix wedged state X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~530^2^2~90 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=0531fc54e52407eb11dd04d3e1ab39ef343bdcb8;p=gnome-shell.git status/bluetooth: Fix wedged state Fix a state where toggling the main Bluetooth switch in the header will always show the "Bluetooth Off" menu header with "Turn Off" as the only option. To reproduce, with Bluetooth enabled and working, run "hciconfig hci0 down" as root, and check the status menu. See gnome-bluetooth!102 and gnome-control-center!1148 Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/4857 Part-of: --- diff --git a/js/ui/status/bluetooth.js b/js/ui/status/bluetooth.js index 3e49a5591..d1304cac5 100644 --- a/js/ui/status/bluetooth.js +++ b/js/ui/status/bluetooth.js @@ -25,6 +25,7 @@ class Indicator extends PanelMenu.SystemIndicator { this._indicator = this._addIndicator(); this._indicator.icon_name = 'bluetooth-active-symbolic'; this._hadSetupDevices = global.settings.get_boolean(HAD_BLUETOOTH_DEVICES_SETUP); + this._client = new GnomeBluetooth.Client(); this._proxy = new RfkillManagerProxy(Gio.DBus.session, BUS_NAME, OBJECT_PATH, (proxy, error) => { @@ -43,6 +44,8 @@ class Indicator extends PanelMenu.SystemIndicator { this._toggleItem = new PopupMenu.PopupMenuItem(''); this._toggleItem.connect('activate', () => { this._proxy.BluetoothAirplaneMode = !this._proxy.BluetoothAirplaneMode; + if (!this._proxy.BluetoothAirplaneMode) + this._client.default_adapter_powered = true; }); this._item.menu.addMenuItem(this._toggleItem); @@ -52,7 +55,6 @@ class Indicator extends PanelMenu.SystemIndicator { this._syncId = 0; this._adapter = null; - this._client = new GnomeBluetooth.Client(); this._store = this._client.get_devices(); this._deviceNotifyConnected = []; this._client.connect('device-removed', (c, path) => { @@ -146,6 +148,6 @@ class Indicator extends PanelMenu.SystemIndicator { else this._item.label.text = _('Bluetooth On'); - this._toggleItem.label.text = this._proxy.BluetoothAirplaneMode ? _('Turn On') : _('Turn Off'); + this._toggleItem.label.text = this._client.default_adapter_powered ? _('Turn Off') : _('Turn On'); } });